package com.olympus.hermes.common.bean;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.persistence.AttributeConverter;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author Mickey
 * @since 2021/2/6
 */
public class JsonObjectBeanConverter<T> implements AttributeConverter<T, String> {

    private Class<T> xclazz;

    private ObjectMapper objectMapper;

    public JsonObjectBeanConverter(ObjectMapper objectMapper) {
        System.out.println(objectMapper);
        xclazz = (Class<T>) (((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments())[0];
    }

    @Override
    public String convertToDatabaseColumn(T attribute) {

        return null;
    }

    @Override
    public T convertToEntityAttribute(String dbData) {
        return null;
    }
}
